package com.example.medicalretrieval.adapter;


import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.List;

public class FragAdapter extends FragmentStateAdapter {

    private List<Fragment> mFragment;

    public FragAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    public FragAdapter(@NonNull Fragment fragment) {
        super(fragment);
    }

    public FragAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle,List<Fragment> fragmentList) {
        super(fragmentManager, lifecycle);
        mFragment = fragmentList;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return mFragment.get(position);
    }

    @Override
    public int getItemCount() {
        return mFragment.size();
    }
}
